import React, { Component } from "react";

export default class App extends Component {
  //   constructor() {
  //     super();
  //     this.state = { status: true };
  //   }
  state = {
    status: true,
  };
  render() {
    return (
      <div>
        <button
          onClick={() => {
            this.setState({ status: !this.state.status }, () => {
              // XXXXX请求接口  传给后端
              console.log(this.state.status);
            });
          }}
        >
          {this.state.status ? "启用" : "禁用"}
        </button>
      </div>
    );
  }
}
